#!/bin/bash
#set -x
export ii=$II
export i=$I
export lsvn_loc=
if [[ "$1" = "-l" ]] ; then
	export lsvn_loc=$2
	shift 2
fi
if [[ "$1" = "-r" ]] ; then
  shift 2
fi
dir="$1"
fn="$2"
#set -x
if [[ -n "$lsvn_loc" ]] ; then
	export SVN_LOC=$lsvn_loc
elif [[ -z "$SVN_LOC" ]] ; then
	export SVN_LOC=$CVS_LOC
fi
sdir="$(dirname $dir)/updfiles"
mkdir -p $sdir
cd $dir
rfn=$(basename $fn)
echo $fn
cmpfile="$sdir/$rfn-$(date +%F:%R)"
cp $fn "$cmpfile"
if [[ ! -f $cmpfile ]] ; then
echo Copy failed
exit 1
fi
$SVN_LOC/svn update $fn 2>&1 | tee -a $ii/whyupdl
diff -wB $fn "$cmpfile" | tee -a $ii/whyupdl
#cvs admin -kb $fn
